]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
animation: Prevent spinner animation from resetting
authorVicente Bertolotti <bertolotti2008@gmail.com>
Sat, 25 Apr 2026 01:26:28 +0000 (21:26 -0400)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 25 Apr 2026 12:55:21 +0000 (14:55 +0200)
Currently, the search status spinner animation restarts on every
single keystroke while a search is in progress. This occurs because
redundant calls to `play()` replace the previous content and restart
the animation from the beginning.

This commit fixes this by ignoring redundant `play()` and `stop()` calls.

Closes https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8695

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4191>

js/ui/animation.js

index 882241cb1e5678a96c26ccdb583f63f54d1ec475..a76bc3a9adbefa17c6a1d74adb36fc1ab028cf2e 100644 (file)
@@ -32,6 +32,8 @@ class Spinner extends St.Widget {
     }
 
     play() {
+        if (this._playing)
+            return;
         this.remove_all_transitions();
         this.set_content(new St.SpinnerContent());
         this.show();
@@ -49,6 +51,8 @@ class Spinner extends St.Widget {
     }
 
     stop() {
+        if (!this._playing)
+            return;
         this.remove_all_transitions();
 
         if (this._animate) {
@@ -70,4 +74,8 @@ class Spinner extends St.Widget {
                 this.hide();
         }
     }
+
+    get _playing() {
+        return this.visible && this.content !== null;
+    }
 });